package com.jin.rules.controller;

import com.jin.rules.bean.Rules;
import com.jin.rules.service.RulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping(value = "/rules")
public class RulesController {

    @Autowired
    private RulesService rulesService;

    @RequestMapping(value ="/write" ,method = RequestMethod.POST)
    public String getRuleByWrite(@RequestBody Rules rule) {

        return rulesService.executeRules(rule.getId());
    }

}
